Add wait events for COPY file/program operations#11
Open
NikolayS wants to merge 1 commit intoclaude/review-postgres-discussions-n0hWBfrom
Open
Add wait events for COPY file/program operations#11NikolayS wants to merge 1 commit intoclaude/review-postgres-discussions-n0hWBfrom
NikolayS wants to merge 1 commit intoclaude/review-postgres-discussions-n0hWBfrom
Conversation
fe60593 to
e0fe9e6
Compare
416f8ea to
fd54927
Compare
Add two new IO wait events: - COPY_DATA_READ: COPY FROM blocking on file or program read - COPY_DATA_WRITE: COPY TO blocking on file or program write This enables diagnosing: - Storage I/O bottlenecks during bulk loads (COPY FROM '/path/to/file') - Slow exports to files (COPY TO '/path/to/file') - Pipe buffer congestion in ETL pipelines (COPY FROM/TO PROGRAM) COPY FROM/TO STDIN/STDOUT already have coverage via Client/ClientRead and Client/ClientWrite at the protocol layer. These events are distinct from the existing COPY_FILE_READ/WRITE events, which instrument file-to-file copy operations in basebackup code. Example usage: -- Session 1: COPY large_table TO '/slow/nfs/mount/out.csv'; -- Session 2: SELECT wait_event, wait_event_type FROM pg_stat_activity WHERE pid = <session1_pid>; -- Shows: COPY_DATA_WRITE / IO
fd54927 to
54a3b83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
COPY operations previously showed
wait_event = NULLwhen blocking on file/program I/O, making it impossible to diagnose performance issues during data loading, ETL operations, or pg_dump/pg_restore.This patch adds two new IO wait events:
COPY_DATA_READ: When COPY FROM blocks reading from file or programCOPY_DATA_WRITE: When COPY TO blocks writing to file or programCoverage
Note: STDIN/STDOUT already have coverage via
Client/ClientReadandClient/ClientWriteevents at the protocol layer.Use Cases
Changes
src/backend/commands/copyfromparse.c: Wrapfread()with wait eventssrc/backend/commands/copyto.c: Wrapfwrite()with wait eventssrc/backend/utils/activity/wait_event_names.txt: Add event definitions